/**
 * Tool Results Shared Styles
 * Common styles for all tool result components
 */

// Color scheme for relevance levels
@relevance-high: #00a870;
@relevance-medium: #ff9800;
@relevance-low: #757575;
@relevance-weak: #bdbdbd;

// Card colors
@card-bg: #ffffff;
@card-border: #e5e7eb;
@card-hover-border: #07c05f;
@card-radius: 6px;
@card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
@card-shadow-hover: 0 2px 6px rgba(7, 192, 95, 0.08);

// Animation timing
@transition-time: 0.2s;

// Tool result container
.tool-result-container {
  margin: 12px 0;
}

// Relevance badge styles
.relevance-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  gap: 3px;
  line-height: 1.4;

  &.high {
    background-color: rgba(0, 168, 112, 0.12);
    color: @relevance-high;
  }

  &.medium {
    background-color: rgba(255, 152, 0, 0.12);
    color: #d67700;
  }

  &.low {
    background-color: rgba(117, 117, 117, 0.12);
    color: @relevance-low;
  }

  &.weak {
    background-color: rgba(189, 189, 189, 0.12);
    color: #666;
  }
}

// Match type badge
.match-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  background-color: #f3f4f6;
  color: #6b7280;
  gap: 2px;
  line-height: 1.4;
}

// Result card
.result-card {
  background: @card-bg;
  border: 1px solid @card-border;
  border-radius: @card-radius;
  margin-bottom: 0;
  overflow: hidden;
  transition: border-color @transition-time ease, box-shadow @transition-time ease;
  box-shadow: @card-shadow;

  &:hover {
    border-color: @card-hover-border;
    box-shadow: @card-shadow-hover;
  }
}

.result-header {
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease;

  &:hover {
    background: rgba(7, 192, 95, 0.04);
  }
  
  * {
    pointer-events: none;
  }
}

.result-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6b7280;
  flex-shrink: 0;
}

.result-content {
  padding: 0;
  border-top: 1px solid @card-border;
  background: white;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height @transition-time ease, opacity @transition-time ease, padding @transition-time ease;

  &.expanded {
    max-height: 2000px;
    opacity: 1;
    padding: 12px;
  }
}

.expand-icon {
  font-size: 12px;
  color: #9ca3af;
  transition: transform 0.15s ease, color 0.15s ease;

  &.expanded {
    transform: rotate(180deg);
  }
}

// Info sections
.info-section {
  margin-top: 12px;

  &:first-child {
    margin-top: 0;
  }
}

.info-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.info-field {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.5;

  .field-label {
    color: #6b7280;
    min-width: 80px;
    flex-shrink: 0;
    font-weight: 500;
  }

  .field-value {
    color: #374151;
    flex: 1;
    word-break: break-word;
  }
}

// Statistics card (for KB counts, etc.)
.stats-card {
  background: rgba(7, 192, 95, 0.04);
  border: 1px solid rgba(7, 192, 95, 0.15);
  border-radius: @card-radius;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.stats-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-item {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  justify-content: space-between;
  line-height: 1.5;
}

// Grid layout for cards
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

// List item
.list-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid #f3f4f6;

  &:last-child {
    border-bottom: none;
  }
}

// Content preview (truncated)
.content-preview {
  font-size: 12px;
  color: #374151;
  line-height: 1.6;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

// Full content
.full-content {
  font-size: 12px;
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px;
  background: #f9fafb;
  border-radius: 4px;
  border: 1px solid @card-border;
}

// Action buttons
.action-button {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid @card-border;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;

  &:hover {
    border-color: @card-hover-border;
    color: @card-hover-border;
    background: rgba(7, 192, 95, 0.04);
  }
}

// Empty state
.empty-state {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
  background: #f9fafb;
  border-radius: @card-radius;
  border: 1px dashed @card-border;
}

// Code block
.code-block {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 11px;
  background: #f9fafb;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid @card-border;
  overflow-x: auto;
  line-height: 1.5;
}

